/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.suli.inventory.service;

import com.alibaba.fastjson.JSONObject;
import me.zhengjie.entity.Result;
import me.zhengjie.suli.inventory.domain.Inventory;
import me.zhengjie.suli.inventory.domain.InventoryDetail;
import me.zhengjie.suli.inventory.service.dto.InventoryDto;
import me.zhengjie.suli.inventory.service.dto.InventoryQueryCriteria;
import me.zhengjie.suli.tasks.domain.TaskDetail;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
* @website https://eladmin.vip
* @description 服务接口
* @author WYH
* @date 2024-02-01
**/
public interface InventoryService {

    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(InventoryQueryCriteria criteria, Pageable pageable);

    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<InventoryDto>
    */
    List<InventoryDto> queryAll(InventoryQueryCriteria criteria);

    /**
     * 根据ID查询
     * @param id ID
     * @return InventoryDto
     */
    InventoryDto findById(String id);

    /**
    * 创建
    * @param resources /
    * @return InventoryDto
    */
    InventoryDto create(Inventory resources);

    /**
    * 编辑
    * @param resources /
    */
    void update(Inventory resources);

    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(String[] ids);

    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<InventoryDto> all, HttpServletResponse response) throws IOException;

    /**
     * 根据物料编码查询供应商
     * @param codes
     * @return
     */
    Result selectSupplier(String codes);
    String noOutBound(String param,String type);

    JSONObject freeze(String param);

    JSONObject thaw(String param);

    JSONObject free(String param);

    JSONObject freeToVmi(String param);

    JSONObject notRestricted(String param);


    List<Map<String, Object>> getInventoryLot(String data);

    List<Map<String, Object>> getInventoryBox(String boxNumber);

    /** 库存主表 Allen Gao 2024-04-11 */
    Map<String, Object> getInventoryGroupByMaterialCode(InventoryQueryCriteria criteria, Pageable pageable);

    String checkCountByLotCodeUpdateCount(Integer count);
    String returnLocationZanCun();
    List<Inventory> outBoundByZanCunSelect();
    List<Inventory> queryOutZanCunByCondition(String param);

    Inventory getInventoryByTrayCode();
    Inventory queryInventoryByBoxNumber(String boxNumber);

    Map<String,Object> outBoundByDoc(String param);

    Inventory findInventoryByTrayCode();

    String returnLocationByBoxNumber(String param);
    String outBoundByZanCun(String param);

    int receiveFreezeInventoryBillNumberFromPDA(String param);

    int autoTally();

    int generateTallyTasks();
}